#ifndef _BIT_H_
#define _BIT_H_

/*
	Note These two functions originally came from a class that I took
	in college at ucr. The classes were CS120B and CS122A. I ended up having
	to modify the functions slight to get them to work how I wanted to
	in the end however. A lot of the classes I have made that deal with
	bit operations depend on these two functions in the end for simple
	bit manipulation and retrieval.
*/
////////////////////////////////////////////////////////////////////////////////
//Functionality - Sets bit on a PORTx
//Parameter: Takes in a uChar for a PORTx, the pin number and the binary value
//Returns: The new value of the PORTx
unsigned char SetBit(unsigned char pin, unsigned char number, unsigned char bin_value);

////////////////////////////////////////////////////////////////////////////////
//Functionality - Gets bit from a PINx
//Parameter: Takes in a uChar for a PINx and the pin number
//Returns: The value of the PINx
unsigned char GetBit(unsigned char port, unsigned char number);

///////////////////////////////////////////////////////////////////////////
//These are some functions I created after realizing that for some setups
//it would be nice to set bits in groups. This will make life easier to deal
//with later on.

//Gets a group of bits after setting a start location and a size of bits
//to get. Port is the value to get the bit group from. Size is the number of bits
//to get. Start tells the starting bit in the group. The rest of the bits are of
//a higher bit number after the start bit.
unsigned char GetBitGroup(unsigned char port, unsigned char size,
			 unsigned char start);

//this sets a group of bits in the port. It is assumed the bits in value are aligned
//with 0 and continue size bits to be set.
unsigned char SetBitGroup(unsigned char port, unsigned char size, 
			  unsigned char start, unsigned char value);



#endif

